﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.IO;
using System.Windows;
using System.Windows.Forms;

namespace SurvivalSolitair
{
    public class DropZone
    {
        private int type;
        public double Offset { get; private set; }
        public PictureBox backGround = new PictureBox();
        public int cardsOnStack;
        public int vertOffset;

        public Point hitBoxPosition = new Point();

        private List<DropZone> ourField;
        public DropZone(Control Parent,int x,int y,int type = 0)
        {
            this.type = type;
            Offset = type * 18;
            cardsOnStack = 0;
            vertOffset = 0;

            backGround.Image = Image.FromFile(Directory.GetCurrentDirectory() + @"\Data\Sprites\" + "dropzone.png");
            backGround.Visible = true;
            backGround.Width = 75;
            backGround.Height = 109;
            backGround.Location = new Point(x, y);
            backGround.Enabled = true;
            backGround.Parent = Parent;
            Parent.Controls.Add(this.backGround);



        }

        public void UpdateHitBox()
        {

            vertOffset = cardsOnStack * type * 10;
            hitBoxPosition.Y = vertOffset;


        }
        public delegate void updateList(List<DropZone> t);
        public static event updateList eventUpdateList;
        public void onCardPlace(Card origin,DropZone target,PlaceCardArgs e)
        {
            ++cardsOnStack;
            ourField = e.list;
            eventUpdateList(ourField);
        }

 





    }
}
